//
//  ShenPiJiLuViewController.m
//  JuBoCRM
//
//  Created by iMac on 2024/2/22.
//  Copyright © 2024 iningKe. All rights reserved.
//

#import "ShenPiJiLuViewController.h"
#import "ShenPiJiLuListViewController.h"
@interface ShenPiJiLuViewController ()<UITextFieldDelegate>{
    UITextField *searchTf;
}

@end

@implementation ShenPiJiLuViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    
    [self setupNavBar];
    [self loadCustomView];
}
- (void)loadCustomView{
    NSArray *data = @[@"待办",@"已办",@"已发起"];
    WMZPageParam *param = PageParam()
    .wTitleArrSet(data)
    .wMenuBgColorSet([UIColor whiteColor])
    .wMenuTitleColorSet(rgba(163, 168, 185, 1))
    .wMenuTitleSelectColorSet(rgba(24, 27, 37, 1))
    .wMenuAnimalTitleGradientSet(YES)
    .wMenuTitleWidthSet((ScreenWidth-30)/3)
//    .wMenuIndicatorImageSet(@"下划线")
    .wMenuIndicatorColorSet(rgba(40, 120, 255, 1))
    .wMenuIndicatorWidthSet(17.5)
    .wMenuIndicatorHeightSet(4)
    .wMenuIndicatorRadioSet(2)
    .wMenuWidthSet(PageVCWidth - 16)
    .wMenuPositionSet(PageMenuPositionCenter)
    .wMenuFixShadowSet(NO)
    .wMenuHeightSet(50)
    .wMenuTitleUIFontSet([UIFont systemFontOfSize:16])
    .wMenuTitleSelectUIFontSet([UIFont systemFontOfSize:18 weight:UIFontWeightMedium])
    //控制器数组
    .wViewControllerSet(^UIViewController *(NSInteger index) {
       
        ShenPiJiLuListViewController*vc = ShenPiJiLuListViewController.new;
        vc.status = [NSString stringWithFormat:@"%ld",index+1];
        return vc;
    })
    .wCustomTabbarYSet(^CGFloat(CGFloat nowY) {
        return nowY;
    })
    .wBouncesSet(YES)
    //控制器结束切换
    .wEventEndTransferControllerSet(^(UIViewController *oldVC, UIViewController *newVC, NSInteger oldIndex, NSInteger newIndex) {
       NSLog(@"结束切换 %ld %ld",oldIndex,newIndex);
   
        
     })
    .wMenuHeadViewSet(^UIView *{
        
        
        UIView *backView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, ScreenWidth, NavaBarHeight)];
        backView.backgroundColor = [UIColor whiteColor];
        
//        UIView *backView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, ScreenWidth, 56+NavaBarHeight)];
//        backView.backgroundColor = [UIColor whiteColor];
   
//        UIView *searchBackView = [[UIView alloc] initWithFrame:CGRectMake(16, NavaBarHeight+16, ScreenWidth-32, 36)];
//        searchBackView.clipsToBounds = YES;
//        searchBackView.layer.cornerRadius = 5;
//        searchBackView.backgroundColor = rgba(247, 248, 250, 1);
//        [backView addSubview:searchBackView];
//        
//        UIImageView *searcImage = [[UIImageView alloc] initWithFrame:CGRectMake(12, 9, 18, 18)];
//        searcImage.image = LocalImagePath(@"地图搜索");
//        [searchBackView addSubview:searcImage];
// 
//        searchTf = [[UITextField alloc] initWithFrame:CGRectMake(35, 0, ScreenWidth-32-35-16, 36)];
//        searchTf.placeholder = @"请输入关键字";
//        searchTf.font = [UIFont systemFontOfSize:14];
//        searchTf.returnKeyType = UIReturnKeySearch;
//        searchTf.delegate = self;
//        [searchBackView addSubview:searchTf];
       
        return backView;
    })
    //悬浮开启
    .wTopSuspensionSet(NO)
    //顶部可下拉
    .wBouncesSet(NO)
    //头视图y坐标从导航栏开始
    .wFromNaviSet(NO)
    //导航栏透明度变化
    .wMenuDefaultIndexSet(_currentIndex)
    .wNaviAlphaSet(YES)
    .wMenuAnimalSet(PageTitleMenuAiQY);


    param.wCustomDataViewHeight = ^CGFloat(CGFloat nowY) {
        /// 再减掉父类的菜单高度
        return nowY-NavaBarHeight;
    };

    self.param = param;
}

- (BOOL)textFieldShouldReturn:(UITextField *)textField{
    [self.view endEditing:YES];

    return YES;
}
- (void)setupNavBar{
    
    [self.view addSubview:self.customNavBar];
    [self.customNavBar wr_setBottomLineHidden:YES];
    if (self.navigationController.childViewControllers.count != 1) {
        [self.customNavBar wr_setLeftButtonWithImage:[UIImage imageNamed:@"返回"]];
    }
}



- (WRCustomNavigationBar *)customNavBar{
    if (_customNavBar == nil) {
        _customNavBar = [WRCustomNavigationBar CustomNavigationBar];
        _customNavBar.tintColor = rgba(24, 27, 37, 1);
        _customNavBar.titleLabelColor = rgba(24, 27, 37, 1);
        _customNavBar.barBackgroundImage = LocalImagePath(@"");
        _customNavBar.titleLabelFont = [UIFont systemFontOfSize:18 weight:UIFontWeightMedium];
        _customNavBar.title = @"审批";
    }
    return _customNavBar;
}
/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
